<?php
namespace  Android\Model;
use Think\Model;

class CardModel extends Model
{
    //得到vip卡片
    /*
     * @ param int type(0推荐1品牌2住宿.3餐饮 4超市 5美护 6线上.)
     *
     */
    public function  VIP(&$type){
       $where= $type==0? "groom=1 and belong=1" :"sh.type=".$type." and belong=1";
        $info= $this->alias(ca)->field('sh.shop_name,sh.intro,sh.shop_addr,us.nickname,ca.card_id')->join('shop sh on sh.shop_id=ca.shop_id')->join('user us on us.user_id= ca.shop_id')->where($where) ->select();
        $info= $this->alias(ca)->field('sh.shop_name,sh.intro,sh.shop_addr,us.nickname,ca.card_id')->join('shop sh on sh.shop_id=ca.shop_id')->join('user us on us.user_id= ca.shop_id')->where($where) ->select();
        return $info;
    }
    //得到我的会员卡
    public  function Mycard(&$user_id){
       $info= $this->alias(ca)->field('ca.card_id,ca.card_num,sh.type')->join('shop sh on ca.shop_id=sh.shop_id')->where('ca.user_id='.$user_id." and is_share=0 and belong in(1,2)")->select();

        return $info;
    }
}